#include <windows.h>

#define D2TRUE TRUE
#define D2FALSE FALSE

typedef BOOL (*type_pfnCallback)();

//size must be 0x3C8
#pragma pack(push, 1)
typedef struct
{
    DWORD expansion;
    BYTE window_mode;
    BYTE fix_aspect_ratio;
    BYTE glide_mode;
    BYTE opengl_mode;
    BYTE rave_mode;
    BYTE d3d_mode;
    BYTE perspective;
    BYTE low_quality;
    DWORD gamma;
    BYTE vsync;
    DWORD frame_rate;
    WORD join_id;
    char game_name[24];
    char game_ip[24];
    char bnet_ip[24];
    char mcp_ip[24];
    DWORD unk1;
    BYTE no_pk;
    BYTE open_c;
    BYTE amazon;
    BYTE paladin;
    BYTE sorceress;
    BYTE necromancer;
    BYTE barbarian;
    BYTE dru;
    BYTE asn;
    BYTE invincible;
    char account_name[48];
    char player_name[24];
    char realm_name[27];    //end at 0xE8
    char acPadding[0x1E9 - 0xE8];
    WORD c_temp; //0x1E9
    WORD char_flags;
    BYTE no_monsters;
    DWORD monster_class;
    BYTE monster_info;
    DWORD monster_debug;
    BYTE item_rare;
    BYTE item_unique;   //end at 0x1F9
    BYTE bPadding;
    DWORD act; //0x1FB
    BYTE no_preload;
    BYTE direct;
    BYTE low_end;
    BYTE no_gfx_compress;
    DWORD arena;    //end at 0x206
    char acPadding2[0x20D - 0x206];
    type_pfnCallback mpq_callback; //0x20D
    BYTE txt;
    BYTE log;
    BYTE msg_log;
    BYTE safe_mode;
    BYTE no_save;
    DWORD seed;
    BYTE cheats;
    BYTE teen;
    BYTE no_sound;
    BYTE quests;
    BYTE unk4;
    BYTE build;
    BYTE sound_background;
    void* bnet_callbacks;   //end at 0x225
    char acPadding3[0x241 - 0x225];
    char game_pass[24]; //0x241 end at 0x259
    char acPadding4[0x359 - 0x259];
    BYTE skip_to_bnet; //0x359 end at 0x35A
    BYTE unk5; //0x35A end at 0x35B
    char acPadding5[0x3C6 - 0x35B];
    WORD unk6; //0x3C6
} ST_CLIENT_DATA;
#pragma pack(pop)

#define MAX_EXTEND_MPQ  10
#define MAX_EXTEND_PLUGIN  10
typedef struct client_extend
{
    char m_acGameTitle[MAX_PATH];
    char m_acLanguageMpq[MAX_PATH];
    BYTE m_dwExtendMpq;
    char m_aacExtendMpq[MAX_EXTEND_MPQ][MAX_PATH];
    BYTE m_dwExtendPlugin;
    char m_aacExtendPlugin[MAX_EXTEND_PLUGIN][MAX_PATH];
    char m_supermod_path[MAX_PATH];
}ST_CLIENT_DATA_EX;

void set_default_command(ST_CLIENT_DATA *pstClientData,ST_CLIENT_DATA_EX* pstClientData_ex);
void parse_command(int argc, char** argv, ST_CLIENT_DATA *pstClientData,ST_CLIENT_DATA_EX* pstClientData_ex,char m_acGlobalMpqPath[MAX_PATH]);